<template>
  <div class='dialog' v-show="flag">
      <div class="content">
          <h3>{{ title }}<b @click="close">X</b></h3>
          <p>{{ text }}</p>
          <span class="footer">
                <button @click="flag=false">提交</button>
                <button @click="flag=false">取消</button>
          </span>
      </div>
  </div>
</template>

<script>
export default {
    data() {
        return {
            flag:false,
            title:"标题",
            text:"这是内容信息"
        }
    },
    methods: {
        close(){
            let show=window.confirm("确认关闭吗？");
            this.flag=!show;
        }
    },
}
</script>

<style lang='scss'>
.dialog{
  width: 100%;
  height: 100%;
  position: fixed;
  left: 0;
  top: 0;
  background: rgba(0,0,0,.5);
  .content{
      min-width: 200px;
      min-height: 150px;
      padding: 5px 20px;
      background: #fff;
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%,-50%);
      h3{
          line-height: 20px;
      }
      .footer{
           position: absolute;
           bottom: 5px;
      }
      b{
          float: right;
      }
  }
}
</style>